home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / execlib / create_exec_windows.c next >
Encoding:
C/C++ Source or Header  |  1990-01-17  |  4.1 KB  |  119 lines

  1. /*
  2. ### create an execution window ###
  3. */
  4.  
  5. #include <suntool/sunview.h>
  6. #include <suntool/panel.h>
  7. #include <suntool/textsw.h>
  8.  
  9.  
  10. void create_exec_windows()
  11. {
  12.  
  13.     extern int ycanvas,ywidth,b_margin;
  14.     extern short exec_panel_show;
  15.     extern Frame frame,exec_frame;
  16.     extern Panel exec_panel;
  17.     extern Panel_item exec_panel_quit_item,exec_panel_go_item, exec_panel_load_item,
  18.         exec_dir_name_item, exec_file_name_item, exec_input_name_item;
  19.     extern Textsw exec_textsw;
  20.     extern Textsw_status exec_status; 
  21.     extern Pixfont *boldfont;
  22.     extern int panel_colormap_on;
  23.     extern char string[],exec_dir_name[],exec_file_name[],exec_input_name[];
  24.         void exec_panel_quit_proc(),exec_panel_go_proc(),exec_panel_load_proc();
  25.  
  26.     if(exec_panel_show){
  27.         window_set(exec_frame,WIN_SHOW, TRUE,0);
  28.         return;
  29.     }
  30.     else
  31.         exec_panel_show = 1;
  32.         exec_frame = window_create(frame,FRAME,FRAME_LABEL,"execution",
  33.                 FRAME_SHOW_LABEL,       TRUE,
  34.         FRAME_NO_CONFIRM,    TRUE,
  35.                 WIN_SHOW,       TRUE,
  36.                 WIN_X, 400,
  37.         WIN_WIDTH,    400,
  38.         WIN_HEIGHT,    300,
  39.                 0);
  40.     if(exec_frame == NULL) {
  41.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  42.         exec_panel_show = 0;
  43.         return;
  44.     }
  45.         exec_panel = window_create(exec_frame, PANEL,
  46.         WIN_X,    0,
  47.         WIN_Y,    0,
  48.         0);
  49.     if(exec_panel == NULL) {
  50.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  51.         (void) destroy_exec_windows();
  52.         return;
  53.     }
  54.         exec_panel_quit_item= panel_create_item(exec_panel,PANEL_BUTTON,
  55.                 PANEL_LABEL_Y,  ATTR_ROW(0),
  56.                 PANEL_LABEL_X,  ATTR_COL(0),
  57.                 PANEL_LABEL_IMAGE,panel_button_image(exec_panel,"Quit",8,boldfont),
  58.                 PANEL_NOTIFY_PROC,exec_panel_quit_proc,
  59.                 0);
  60.         exec_panel_go_item= panel_create_item(exec_panel,PANEL_BUTTON,
  61.                 PANEL_LABEL_Y,  ATTR_ROW(0),
  62.                 PANEL_LABEL_X,  ATTR_COL(10),
  63.                 PANEL_LABEL_IMAGE,panel_button_image(exec_panel,"Go",8,boldfont),
  64.                 PANEL_NOTIFY_PROC,exec_panel_go_proc,
  65.                 0);
  66.         exec_panel_load_item= panel_create_item(exec_panel,PANEL_BUTTON,
  67.                 PANEL_LABEL_Y,  ATTR_ROW(0),
  68.                 PANEL_LABEL_X,  ATTR_COL(20),
  69.                 PANEL_LABEL_IMAGE,panel_button_image(exec_panel,"Load",8,boldfont),
  70.                 PANEL_NOTIFY_PROC,exec_panel_load_proc,
  71.                 0);
  72.         exec_dir_name_item = panel_create_item(exec_panel,PANEL_TEXT,
  73.                 PANEL_LABEL_Y,  ATTR_ROW(1),
  74.                 PANEL_LABEL_X,  ATTR_COL(0),
  75.                 PANEL_VALUE,    exec_dir_name,
  76.                 PANEL_VALUE_DISPLAY_LENGTH, 40,
  77.                 PANEL_LABEL_STRING, "Dir:",
  78.                 0);
  79.         exec_file_name_item = panel_create_item(exec_panel,PANEL_TEXT,
  80.                 PANEL_LABEL_Y,  ATTR_ROW(2),
  81.                 PANEL_LABEL_X,  ATTR_COL(0),
  82.                 PANEL_VALUE,    exec_file_name,
  83.                 PANEL_VALUE_DISPLAY_LENGTH, 40,
  84.                 PANEL_LABEL_STRING, "Exec File:",
  85.                 0);
  86.         exec_input_name_item = panel_create_item(exec_panel,PANEL_TEXT,
  87.                 PANEL_LABEL_Y,  ATTR_ROW(3),
  88.                 PANEL_LABEL_X,  ATTR_COL(0),
  89.                 PANEL_VALUE,    exec_input_name,
  90.                 PANEL_VALUE_DISPLAY_LENGTH, 40,
  91.                 PANEL_LABEL_STRING, "Input File:",
  92.                 0);
  93.         window_fit_height(exec_panel);
  94.  
  95.     if(panel_colormap_on)
  96.         init_panel_colormap((Pixwin *) window_get(exec_panel,WIN_PIXWIN),"exec_panel_cms");
  97.  
  98.         sprintf(string,"%s/%s",exec_dir_name,exec_input_name);
  99.         exec_textsw = window_create(exec_frame, TEXTSW,
  100.         0);
  101.     if(exec_textsw == NULL) {
  102.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  103.         (void) destroy_exec_windows();
  104.         return;
  105.     }
  106.     window_set(exec_textsw,
  107.                 TEXTSW_STATUS, &exec_status,
  108.                 TEXTSW_FILE,string,
  109.                 TEXTSW_FIRST,0,
  110.                 0);
  111.         if(exec_status == TEXTSW_STATUS_CANNOT_OPEN_INPUT){
  112.                 printf("File (%s) does not exist!\n",string);
  113.         }       
  114.     if(panel_colormap_on)
  115.         init_panel_colormap((Pixwin *) window_get(exec_textsw,WIN_PIXWIN),"exec_textsw_cms");
  116.  
  117. }
  118.  
  119.